#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
@Project ：python_learning 
@File ：set_unit.py
@IDE  ：PyCharm 
@Author ：李涵彬
@Date ：2024/6/4 下午3:22 
"""


def set_unit(unit):
	"""Register a unit on a function"""

	def decorator_set_unit(func):
		func.unit = unit
		return func

	return decorator_set_unit


import math


@set_unit("cm^3")
def volume(radius, height):
	return math.pi * radius ** 2 * height


if __name__ == '__main__':
	volume(3, 5)
